package com.tronsis.recyclerviewdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.tronsis.recyclerviewdemo.adapter.HorizontalRVAdapter;
import com.tronsis.recyclerviewdemo.adapter.RecycleViewDivider;

import java.util.ArrayList;
import java.util.List;

public class HorizontalActivity extends AppCompatActivity {

    private RecyclerView recyclerView;
    private RecyclerView recyclerViewCard;
    private HorizontalRVAdapter mAdapter;
    private HorizontalRVAdapter mAdapter2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_horizontal);
        recyclerView = (RecyclerView) findViewById(R.id.recycler_view_horizontal);
        recyclerViewCard = (RecyclerView) findViewById(R.id.recycler_view_horizontal_card);

        List<String> data = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            data.add(("data" + String.valueOf(i)));
        }

        mAdapter = new HorizontalRVAdapter(data,HorizontalRVAdapter.DEFAULE);
        recyclerView.setAdapter(mAdapter);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.addItemDecoration(new RecycleViewDivider(this, LinearLayoutManager.VERTICAL, 5, getResources().getColor(R.color.colorPrimary)));


        LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(this);
        linearLayoutManager2.setOrientation(LinearLayoutManager.HORIZONTAL);
        mAdapter2 = new HorizontalRVAdapter(data,HorizontalRVAdapter.CARD);
        recyclerViewCard.setAdapter(mAdapter2);
        recyclerViewCard.setLayoutManager(linearLayoutManager2);
    }
}
